<?php
namespace app\admin\validate;

use think\Validate;

class Link extends Validate
{
    protected $rule =   [
        'title'  => 'require|max:25|unique:link',
        'desc'   => 'require',
        'url' => 'require|url|unique:link',    
    ];

    protected $message  =   [
        'title.require' => '链接名称不得为空！',        
        'title.max'     => '链接名称最多不能超过25个字符',
        'title.unique'  => '链接名称不得重复！', 

        'desc.require'   => '链接简介不能为空！',
        'url.require'   => '链接地址不能为空！',
        'url.url'        => '链接地址格式错误！', 
        'url.unique'  => '链接地址不得重复！',
          
    ];

    protected $scene = [
        'edit'  =>  ['title'=>'require','url'],
        'add' =>['title','desc','url'],
    ];

}